package com.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the backmoneyplan database table.
 * 
 */
@Entity
@NamedQuery(name="Backmoneyplan.findAll", query="SELECT b FROM Backmoneyplan b")
public class Backmoneyplan implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="bmp_id")
	private Integer bmpId;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="bmp_bmpdate")
	private Date bmpBmpdate;

	@Column(name="bmp_foreign")
	private String bmpForeign;
	
	@Column(name="bmp_is_back_money")
	private String bmp_isBackMoney;

	@Column(name="bmp_money")
	private BigDecimal bmpMoney;

	@Column(name="bmp_status")
	private Integer bmpStatus;

	@Column(name="u_id")
	private Integer uId;

	//bi-directional many-to-one association to Orderinfo
	@ManyToOne
	@JoinColumn(name="o_id")
	private Orderinfo orderinfo;

	//bi-directional many-to-one association to Customer
	@ManyToOne
	@JoinColumn(name="cust_id")
	private Customer customer;

	//bi-directional many-to-one association to Returnmoney
	@JsonIgnore
	@OneToMany(mappedBy="backmoneyplan")
	private List<Returnmoney> returnmoneys;

	@Override
	public String toString() {
		return "Backmoneyplan [bmpId=" + bmpId + ", bmpBmpdate=" + bmpBmpdate + ", bmpForeign=" + bmpForeign
				+ ", bmp_isBackMoney=" + bmp_isBackMoney + ", bmpMoney=" + bmpMoney + ", bmpStatus=" + bmpStatus
				+ ", uId=" + uId + "]";
	}

	public Backmoneyplan() {
	}

	public Integer getBmpId() {
		return this.bmpId;
	}

	public void setBmpId(int bmpId) {
		this.bmpId = bmpId;
	}

	public Date getBmpBmpdate() {
		return this.bmpBmpdate;
	}

	public void setBmpBmpdate(Date bmpBmpdate) {
		this.bmpBmpdate = bmpBmpdate;
	}

	public String getBmpForeign() {
		return this.bmpForeign;
	}

	public void setBmpForeign(String bmpForeign) {
		this.bmpForeign = bmpForeign;
	}

	public String getBmp_isBackMoney() {
		return this.bmp_isBackMoney;
	}

	public void setBmp_isBackMoney(String bmp_isBackMoney) {
		this.bmp_isBackMoney = bmp_isBackMoney;
	}

	public BigDecimal getBmpMoney() {
		return this.bmpMoney;
	}

	public void setBmpMoney(BigDecimal bmpMoney) {
		this.bmpMoney = bmpMoney;
	}

	public Integer getBmpStatus() {
		return this.bmpStatus;
	}

	public void setBmpStatus(int bmpStatus) {
		this.bmpStatus = bmpStatus;
	}

	public Integer getUId() {
		return this.uId;
	}

	public void setUId(Integer uId) {
		this.uId = uId;
	}

	public Orderinfo getOrderinfo() {
		return this.orderinfo;
	}

	public void setOrderinfo(Orderinfo orderinfo) {
		this.orderinfo = orderinfo;
	}

	public Customer getCustomer() {
		return this.customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public List<Returnmoney> getReturnmoneys() {
		return this.returnmoneys;
	}

	public void setReturnmoneys(List<Returnmoney> returnmoneys) {
		this.returnmoneys = returnmoneys;
	}

	public Returnmoney addReturnmoney(Returnmoney returnmoney) {
		getReturnmoneys().add(returnmoney);
		returnmoney.setBackmoneyplan(this);

		return returnmoney;
	}

	public Returnmoney removeReturnmoney(Returnmoney returnmoney) {
		getReturnmoneys().remove(returnmoney);
		returnmoney.setBackmoneyplan(null);

		return returnmoney;
	}

}